package composite.pattern.employee;

import java.util.ArrayList;
import java.util.List;

public class Employee {
    private String name;

    private String dep;

    private List<Employee> subordinates;

    public Employee(String name, String dep) {
        super();
        this.name = name;
        this.dep = dep;
        subordinates = new ArrayList<Employee>();
    }

    public List<Employee> getSubordinates() {
        return subordinates;
    }

    public void add(Employee e) {
        subordinates.add(e);
    }

    public void remove(Employee e) {
        subordinates.remove(e);
    }

    public String toString() {
        return ("Employee :[ Name : " + name + ", dep : " + dep + " ]");
    }

}
